package com.zx._09_架构.重构;

/**
 * @program: knowledge
 * @description:
 * @author: xue.zhang
 * @create: 2021-11-17 10:20
 */
public class 提取类或继承体系中的常量 {

    class BadExample {

        public void someMethod1() {
            send("您的操作已成功！");
        }

        public void someMethod2() {
            send("您的操作已成功！");
        }

        public void someMethod3() {
            send("您的操作已成功！");
        }

        private void send(String message) {
            //code
        }
    }

    /* ---------------------分割线---------------------- */

    class GoodExample {

        protected static final String SUCCESS_MESSAGE = "您的操作已成功！";

        public void someMethod1() {
            send(SUCCESS_MESSAGE);
        }

        public void someMethod2() {
            send(SUCCESS_MESSAGE);
        }

        public void someMethod3() {
            send(SUCCESS_MESSAGE);
        }

        private void send(String message) {
            //code
        }
    }
}
